public class TestPerson {
    public static void main(String[] args) {
        Person1 person1 = new Person1("马可", 22);
        boolean result = person1.compareTo("哈哈", 22);
        if (result) {
            System.out.println("信息相同！");
        } else {
            System.out.println("信息不相同！");
        }
    }
}

class Person1 {
    String name;
    int age;
    public Person1(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public boolean compareTo(String name, int age) {
        return this.name.equals(name) && age == this.age;
    }
}

